<?php
require_once 'Student.php';

echo "<h2>学生信息列表</h2>";

$course1 = new Course("CS101", "Introduction to PHP", 3);
$course2 = new Course("MATH202", "Advanced Mathematics", 4);
$course3 = new Course("ENG103", "Academic English", 2);

$students = array();

$john = new Student("Doe", "John");
$john->set_status("Junior");
$john->add_email("home", "john@doe.com");
$john->add_email("school", "john.doe@student.com");
$john->add_course($course1);
$john->add_course($course2);
$john->add_grade("CS101", 85);
$john->add_grade("MATH202", 78);
$students['j123'] = $john;

$albert = new Student("Einstein", "Albert");
$albert->set_status("Freshman");
$albert->add_email("home", "albert@braniacs.com");
$albert->add_email("work", "albert@physics.mit.edu");
$albert->add_course($course1);
$albert->add_course($course3);
$albert->add_grade("CS101", 95);
$albert->add_grade("ENG103", 92);
$students['a456'] = $albert;

$myself = new Student("zhan", "shenlong");
$myself->set_status("Senior");
$myself->add_email("home", "shenlong@depauw.ca");
$myself->add_email("school", "shenlong@bcit.ca");
$myself->add_course($course1);
$myself->add_course($course2);
$myself->add_course($course3);
$myself->add_grade("CS101", 90);
$myself->add_grade("MATH202", 88);
$myself->add_grade("ENG103", 85);
$students['x789'] = $myself;

$bill = new Student("Gates", "Bill");
$bill->set_status("Junior");
$bill->add_email("home", "bill@gates.com");
$bill->add_email("work", "bill.gates@microsoft.com");
$bill->add_course($course1);
$bill->add_course($course2);
$bill->add_grade("CS101", 98);
$bill->add_grade("MATH202", 94);
$students['b012'] = $bill;

ksort($students);

foreach ($students as $student) {
    echo $student->toString();
    echo "<hr>";
}
?>